//
//  StorageInfo.m
//  danpin
//
//  Created by chuangjia on 1/12/2015.
//  Copyright © 2015 chuangjia. All rights reserved.
//

#import "StorageInfo.h"

@implementation StorageInfo
/*
 * 获取货架分类
 * method http://test1.danpin.com/shopstyle_api.php?type=category
 */

+ (void)getStoreRacksCategory:(NSDictionary*)params success:(void(^)(AFHTTPRequestOperation* operation, id result))success failure:(void(^)(NSError* error))failure
{
    NSString *urls =@"/v2/dp_good_list.php?query=category";
    [self requestWithUrl:urls params:nil allowFetchCache:YES success:success failure:failure];
}
/*
 * 获取货架分类对应数据
 * method http://test1.danpin.com/shopstyle_api.php?type=items&offset=0&sort=&category=&brand=&pagesize=1
 */


+ (void)getStoreRacksCategoryItems:(NSDictionary*)params success:(void(^)(AFHTTPRequestOperation* operation, id result))success failure:(void(^)(NSError* error))failure
{
    NSString *urls =@"/v2/dp_good_list.php?query=items&cate1=%@&cate2=%@&cate3=%@&brand=%@&offset=%@&sort=%@&timestamp=%@";
    NSString *strul =[NSString stringWithFormat:urls,
                      [params stringForKey:@"cate1"],
                      [params stringForKey:@"cate2"],
                      [params stringForKey:@"cate3"],
                      [params stringForKey:@"brand"],
                      [params stringForKey:@"from"],
                      [params stringForKey:@"sort"],
                      [params stringForKey:@"timestamp"]];
    [self requestWithUrl:strul params:nil allowFetchCache:NO success:success failure:failure];
}
+ (void)getBrands:(NSDictionary*)params success:(void(^)(AFHTTPRequestOperation* operation, id result))success failure:(void(^)(NSError* error))failure
{
    NSString *urls =@"/v2/dp_good_list.php?query=brands&cate1=%@&cate2=%@&cate3=%@";
    NSString *strul =[NSString stringWithFormat:urls,
                      [params stringForKey:@"cate1"],
                      [params stringForKey:@"cate2"],
                      [params stringForKey:@"cate3"]];
    [self requestWithUrl:strul params:nil allowFetchCache:NO success:success failure:failure];
}
+ (void)haveLove:(NSDictionary*)params success:(void(^)(AFHTTPRequestOperation* operation, id result))success failure:(void(^)(NSError* error))failure
{
    NSString *urls =@"/love.php?action=haveLove&photo_id=%@&uid=%@";
    NSString *strul =[NSString stringWithFormat:urls,
                      [params stringForKey:@"photo_id"],
                     [[ZShare sharedInstance] getUserId]];
    [self requestWithUrl:strul params:nil allowFetchCache:NO success:success failure:failure];
}
+ (void)searchhuojia:(NSDictionary*)params success:(void(^)(AFHTTPRequestOperation* operation, id result))success failure:(void(^)(NSError* error))failure
{
    NSString *urls =@"/v2/search_huojia.php?word=%@";
    NSString *strul =[NSString stringWithFormat:urls,
                      [params stringForKey:@"word"],
                      [[ZShare sharedInstance] getUserId]];
    [self requestWithUrl:strul params:nil allowFetchCache:NO success:success failure:failure];
}
@end
